package com.system.oauthserver.controller;

import com.system.commonutils.bean.ApiResult;
import com.system.oauthserver.bean.UserParams;
import com.system.oauthserver.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.catalina.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.Authentication;
import org.springframework.web.bind.annotation.*;

@Api(tags = "授权服务-授权API")
@RestController
@RequestMapping(value = "auth")
public class AuthController {

    @Autowired
    UserService userService;





    @ApiOperation(value = "登录")
    @PostMapping("/login")
    public ApiResult login(UserParams user){
        return userService.login(user);
    }


    @ApiOperation(value = "刷新token")
    @PostMapping("/refreshToken")
    public ApiResult refreshToken(String refreshToken,String accessToken){
        ApiResult apiResult = userService.refreshToken(refreshToken,accessToken);
        return apiResult;
    }


}
